
package com.bash.carrep.dao.enties;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author bash
 */
@Embeddable
public class OperationEffectuePK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "idDeclaration", nullable = false)
    private int idDeclaration;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "username", nullable = false, length = 10)
    private String username;

    public OperationEffectuePK() {
    }

    public OperationEffectuePK(int idDeclaration, String username) {
        this.idDeclaration = idDeclaration;
        this.username = username;
    }

    public int getIdDeclaration() {
        return idDeclaration;
    }

    public void setIdDeclaration(int idDeclaration) {
        this.idDeclaration = idDeclaration;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) idDeclaration;
        hash += (username != null ? username.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OperationEffectuePK)) {
            return false;
        }
        OperationEffectuePK other = (OperationEffectuePK) object;
        if (this.idDeclaration != other.idDeclaration) {
            return false;
        }
        if ((this.username == null && other.username != null) || (this.username != null && !this.username.equals(other.username))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bash.carrep.dao.enties.OperationEffectuePK[ idDeclaration=" + idDeclaration + ", username=" + username + " ]";
    }
    
}
